home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GTSPCTRT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  672 b   |  21 lines

  1. #include <graphics.h>
  2.  
  3. main()
  4. {
  5.    int graphdriver = DETECT, graphmode;
  6.    char    buffer[80];
  7.    int     xasp, yasp;
  8.    long    xnew;
  9.  
  10.    initgraph(&graphdriver, &graphmode, "c:\\turboc");
  11.  
  12. /* Get the "aspect ratio." and use it to draw a square */
  13.    getaspectratio( &xasp, &yasp );
  14.    xnew = ( 50L * (long) yasp ) / (long) xasp;
  15.    rectangle( 40, 40, 40+(int) xnew, 40+50 );
  16.    sprintf(buffer,"Aspect ratio: xasp = %d, yasp = %d", xasp, yasp);
  17.    outtextxy(10,10, buffer);
  18.    outtextxy(getmaxx()/2, getmaxy() - 50, "Press any key to exit:");
  19.    getch();        /* Wait until a key is pressed */
  20.    closegraph();         /* Exit graphics library */
  21. }